Skip to content

fix: resolve TypeScript build errors in plugin-hono-server and runtime#1142

Merged
hotlong merged 1 commit intomainfrom
claude/fix-ci-build-and-test-errors
Apr 14, 2026
Merged

fix: resolve TypeScript build errors in plugin-hono-server and runtime#1142
hotlong merged 1 commit intomainfrom
claude/fix-ci-build-and-test-errors

Conversation

@Claude
Copy link
Copy Markdown
Contributor

@Claude Claude AI commented Apr 14, 2026

CI builds were failing due to TypeScript errors introduced by recent refactoring: accessing private context property in plugin-hono-server and unused variables in runtime.

Changes

plugin-hono-server - Fixed service access pattern

  • Import IDataEngine from @objectstack/core
  • Replace ctx.getKernel().context?.getService('objectql') with ctx.getService<IDataEngine>('objectql')
  • Properly types the ObjectQL service and uses public API instead of accessing private kernel internals

runtime/http-dispatcher - Cleaned up unused code

  • Prefix unused context parameters with _context in handleMetadata, handleData, and handlePackages methods
  • Remove unused capitalize helper method
// Before
const getObjectQL = () => ctx.getKernel().context?.getService('objectql');

// After
const getObjectQL = () => ctx.getService<IDataEngine>('objectql');

All builds pass, 150 tests passing.

- Fixed TypeScript error in plugin-hono-server by using ctx.getService<IDataEngine>('objectql') instead of accessing private context property
- Fixed unused variable errors in runtime package by prefixing unused parameters with underscore
- Removed unused _capitalize method from http-dispatcher
- All builds now pass successfully
- All tests pass (150/150)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-demo Ready Ready Preview, Comment Apr 14, 2026 0:06am
spec Ready Ready Preview, Comment Apr 14, 2026 0:06am

Request Review

@hotlong hotlong marked this pull request as ready for review April 14, 2026 12:06
Copilot AI review requested due to automatic review settings April 14, 2026 12:06
@hotlong hotlong merged commit ee17e79 into main Apr 14, 2026
13 of 14 checks passed
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.

import { Plugin, PluginContext, IHttpServer } from '@objectstack/core';
import { Plugin, PluginContext, IHttpServer, IDataEngine } from '@objectstack/core';
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes TypeScript build errors introduced by recent refactoring by removing access to private kernel internals and cleaning up unused runtime parameters/helpers.

Changes:

  • plugin-hono-server: Switch ObjectQL service lookup to use the public PluginContext.getService() API with IDataEngine typing.
  • runtime: Silence unused context parameters by renaming to _context and remove an unused capitalize() helper.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/runtime/src/http-dispatcher.ts Renames unused handler parameters to _context and removes an unused helper to resolve TS unused-variable errors.
packages/plugins/plugin-hono-server/src/hono-plugin.ts Updates ObjectQL service access to a typed, public service lookup instead of accessing private kernel context.
Comments suppressed due to low confidence (1)

packages/plugins/plugin-hono-server/src/hono-plugin.ts:290

  • PluginContext.getService() throws when the service is missing (or when the service is async), so const ql = getObjectQL(); if (!ql) ... will never handle the "not available" case and will instead throw and fail the request. Please wrap the ctx.getService('objectql') call in a try/catch (returning undefined/null on failure), or switch getObjectQL to an async helper that uses await ctx.getKernel().getServiceAsync<IDataEngine>('objectql') and handles rejection, so the 503 response path is reachable.
        // Basic CRUD data endpoints — delegate to ObjectQL service directly
        const getObjectQL = () => ctx.getService<IDataEngine>('objectql');

        // Create
        rawApp.post(`${prefix}/data/:object`, async (c: any) => {
            const ql = getObjectQL();
            if (!ql) return c.json({ error: 'Data service not available' }, 503);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants